/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.anhndt.audiobook.business;

import com.anhndt.audiobook.utils.Util;
import org.ksoap2.serialization.SoapObject;

/**
 *
 * @author Sun
 */
public class Service {

    public static final String NAME_SPACE = "http://audiobook.vn/";
    public static final String METHOD_LOGIN = "l";
    public static final String METHOD_GET_CONTENT = "c";
    public static final String METHOD_CHECK_UPDATE = "u";
    private String serviceURL;
    private String methodName;
    private SoapObject request;

    public Service() {
        this(METHOD_GET_CONTENT);
    }
    public Service(String methodName) {
        this.methodName = methodName;
        this.serviceURL = Util.AUDIO_WS;
        request = new SoapObject(NAME_SPACE, methodName);
    }

    public Service(String methodName, String serviceURL) {
        this(methodName);
        this.serviceURL = serviceURL;
    }

    public SoapObject getRequest() {
        return request;
    }

    public String getUrl() {
        return Util.getUrl(serviceURL);
    }

    public String getSoapAction() {
        return NAME_SPACE + methodName;
    }

    public void addProperty(String key, Object value) {
        request.addProperty(key, value);
    }
}
